	global raw "~/agriculture_temperature"

	use $raw/data/forest_mainproduct_weather_idw_region, clear

  rename x3 Chipboard 
  rename x5 RowLog   
  rename x16 sawLog  
  rename x13 Plywood  
  
  	foreach x in RowLog sawLog Chipboard Plywood {
		gen ln_`x' = log(`x')
		}
rename county_code ctycode
drop if ctycode==.

* state-by-year FE		

	gen proXyear = pro*10000 + year	
	xtset ctycode year
	rename dd5bin10 REF_BIN
	
	
******************************Figure D1,Table S13****************
*（1) North products:RowLog sawLog Chipboard Plywood
	foreach x in RowLog sawLog Chipboard Plywood {
		 reghdfe ln_`x' dd5bin* ///
			c.pre##c.pre c.ssd##c.ssd c.rhu##c.rhu c.prs##c.prs c.win##c.win ///
			i.pro#c.year##c.year ///
			if inrange(year,1995,2010) & region3==1,  ///
			absorb(ctycode year) cluster(ctycode proXyear) 
			estimates store ln_`x'
			}	
esttab ln_* using $raw/revision_result/firm_level_products1.rtf,  b(4) se(4) keep(dd5bin* *pre* *ssd* *rhu* *prs* *win* ) star(* 0.10 ** 0.05 *** 0.01) 	


*（2) North products:Non_Timber_Products

	use $raw/data/forest_nonwood_weather_idw_region, clear
  rename x9 Non_Timber_Products
  gen ln_Non_Timber_Products = log(Non_Timber_Products)
rename county_code ctycode
drop if ctycode==.
* state-by-year FE		

	gen proXyear = pro*10000 + year	
	xtset ctycode year
		rename dd5bin10 REF_BIN

*North
	reghdfe ln_Non_Timber_Products dd5bin* ///
	        c.pre##c.pre c.ssd##c.ssd c.rhu##c.rhu c.prs##c.prs c.win##c.win ///
			i.pro#c.year##c.year ///
			if inrange(year,1995,2010) & region3==1,  ///
			absorb(ctycode year) cluster(ctycode proXyear) 
			estimates store ln_Non_Timber_Products
esttab ln_Non_Timber_Products using $raw/revision_result/firm_level_products2.rtf,replace  b(4) se(4) keep(dd5bin* *pre* *ssd* *rhu* *prs* *win* ) star(* 0.10 ** 0.05 *** 0.01) scalar(r2)
